package uk.co.accolade.clash.core;

public class RemoteChangesHandler implements ChangeHandler {

    private ChangesRegistry changesRegistry;

    public RemoteChangesHandler( ChangesRegistry changesRegistry ) {
        this.changesRegistry = changesRegistry;
    }

    public void handleChanges( UserChanges remoteChanges ) {
        if(!changesRegistry.changesAreLocal(remoteChanges)) {
            changesRegistry.applyChanges( remoteChanges );
        }
    }
}
